#include <iostream>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <wait.h>
using namespace std;
int main() {
    pid_t id = 0;
    id = fork();
    if(id == 0)
    {
        int cnt1 = 10;
        while(cnt1)
        {
            cout<<"I am child,Pid:"<<getpid()<<"ppid:"<<getppid()<<endl;
            sleep(1);
            cnt1--;
        }
    }
    else 
    {
        int cnt2 = 20;
        while(cnt2)
        {
            cout<<"I am father,Pid"<<getpid()<<"ppid:"<<getppid()<<endl;
            sleep(1);
            cnt2--;
        }
    }
    return 0;
}
